#!/usr/bin/perl
# ourmodule2.pm
package B::Tree;
use strict;

use GraphViz;
use B qw(main_root walkoptree_slow);
sub compile {
   return sub {
      $g = new GraphViz;
      walkoptree_slow(main_root, "visit");
      print $g->as_dot;
   };
}
sub B::OP::visit {
   my $self = shift;
   $g->add_node({name => $$self, label => $self->name});
}
1;
